package com.zhangyu.shadow.repair.delegate.irregular;

import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

import java.util.List;

/**
 * Created by 张宇 on 2017/3/14.
 */

public class IrregularPagerAdapter extends FragmentStatePagerAdapter {
    private List<Fragment> mDelegates;
    private List<BusCountBean> mTitles;

    public IrregularPagerAdapter(FragmentManager fm,
                                 List<Fragment> fragments,
                                 List<BusCountBean> titles) {
        super(fm);
        this.mDelegates = fragments;
        mTitles = titles;
    }

    @Override
    public Fragment getItem(int position) {
        return mDelegates.get(position);
    }

    @Override
    public int getCount() {
        return mDelegates.size();
    }

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        final BusCountBean bean = mTitles.get(position);
        return bean.getName() + "(" + bean.getCount() + ")";
    }

}
